<template>
  <div>
    <!-- banner -->
    <div
      class="banner"
      :style="cover"
    >
      <h1 class="banner-title" >
        <span v-if="currentPageInfo.pageTitle">{{ currentPageInfo.pageTitle }}</span>
        <span v-else>标签页</span>
      </h1>
      <!-- 主屏幕副标题 -->
      <div class="banner-title-second">
        <span v-if="currentPageInfo.pageIntro" >
          {{ currentPageInfo.pageIntro }}
        </span>
      </div>
    </div>
    <!-- 标签列表 -->
    <v-card class="blog-container">
      <div class="tag-cloud-title">
        标签 - {{ tagList.length }}
      </div>
      <div class="tag-cloud">
        <router-link
          v-for="item of tagList"
          :key="item.id"
          :style="{ 'font-size': Math.floor(Math.random() * 10) + 18 + 'px' }"
          :to="'/tags/' + item.id"
        >
          {{ item.typeValue }}
        </router-link>
      </div>
    </v-card>
  </div>
</template>

<script>
import {metaInfo} from '@/config/BlogConstant'
export default {
  metaInfo:metaInfo,
  data: function() {
    return {
      tagList: [],
      count: 0,
      currentPageInfo:{}
    }
  },
  computed: {
    cover() {
      let cover = ''
      this.$store.state.blogInfo.pageInfo.forEach(item => {
        if (item.pageKey === 'tag') {
          cover = item.headerImgUrl
          this.currentPageInfo = item
        }
      })
      return 'background: url(' + cover + ') center center / cover no-repeat'
    }
  },
  created() {
    this.listTags()
  },
  methods: {
    listTags() {
      this.tagList = this.$store.state.blogInfo.articleTypes
    }
  }
}
</script>

<style scoped>
.tag-cloud-title {
  line-height: 2;
  font-size: 36px;
  text-align: center;
}
@media (max-width: 759px) {
  .tag-cloud-title {
    font-size: 25px;
  }
}
.tag-cloud {
  text-align: center;
}
.tag-cloud a {
  color: #616161;
  display: inline-block;
  text-decoration: none;
  padding: 0 8px;
  line-height: 2;
  transition: all 0.3s;
}
.tag-cloud a:hover {
  color: #03a9f4 !important;
  transform: scale(1.1);
}
</style>
